package alu {
	import actors.PxActor;
	
	public class Loop implements IALU {
		private var _actor:PxActor;
		
		private var _totalCount:int;
		private var _count:int;
		private var _destIndex:int;
		
		public function Loop(actorIn:PxActor, destIndexIn:int, totalCountIn:int) {
			_actor = actorIn;
			_destIndex = destIndexIn;
			_totalCount = totalCountIn;
			_count = 0;
		}
		
		public function update():void {
			if (_count < _totalCount) {
				_count ++;
				_actor.aluIndex = _destIndex;
			}
			else {
				_count = 0;
				_actor.aluIndex ++;
			}
		}
	}
}
